﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.IO;
using System.Diagnostics;
using System.Data.Entity;
using SoccerGameSpider.Scraper;
using ScrapperBase;
using SoccerGameSpider;

namespace SoccerMaster
{
    class Program
    {
        static void Main(string[] args)
        {
            InitDB();

            Trace.Listeners.Add(new ConsoleTraceListener());

            ScraperBase scraper = new GermanyScraper();
            scraper.Scrape();

            //string[] files = Directory.GetFiles(".\\Scrapers", "*Scrapper.dll");

            //foreach (var file in files)
            //{
            //    Assembly assembly = Assembly.LoadFrom(file);
            //    Type type = assembly.ExportedTypes.FirstOrDefault(t => t.GetInterface("IScraper") != null);
            //    IScraper scraper = (IScraper)assembly.CreateInstance(type.FullName, true);
            //    scraper.Scrape();
            //}
        }

        static void InitDB()
        {
            SoccerGameSpider.DataContext.GameContext db = new SoccerGameSpider.DataContext.GameContext();
            //db.Database.Delete();

            db.Database.Initialize(false);
        }
    }
}
